package net.sk.china.front.service.user;

import com.baomidou.mybatisplus.extension.service.IService;
import net.sk.china.common.model.user.User;

import java.math.BigDecimal;

/**
 * UserService 接口
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/4 14:58
 * +----------------------------------------------------------------------
 */
public interface UserService extends IService<User> {

    /**
     * 根据账号查询用户
     * @param account 账号
     * @return {@code User}
     */
    User getByAccount(String account);

    /**
     * 创建令牌
     * @param uid 用户ID
     * @return {@code String}
     */
    String createToken(Integer uid);

    /**
     * 手机号注册用户
     * @param phone 手机号
     * @param loginType 登录类型
     * @param ip 客户端IP
     * @return {@code User}
     */
    User registerPhone(String phone, String loginType, String ip);

    /**
     * 获取系统随机头像
     * @return {@code String}
     */
    String getAvatar();


    /**
     * 账户详情 检测用户异常情况
     * @return {@code User}
     */
    User getUserInfo();

    /**
     * 获取个人资料
     * @return {@code User}
     */
    User getInfo();

    /**
     * 获取用户ID
     * @return {@code Integer}
     */
    Integer getUserId();

    /**
     * 更新用户积分
     * @param user 用户
     * @param integral 积分
     * @param type 增加add、扣减sub
     * @return {@code boolean}
     */
    boolean updateIntegral(User user, Integer integral, String type);

    /**
     * 更新余额
     * @param user 用户
     * @param price 金额
     * @param type 增加add、扣减sub
     * @return {@code boolean}
     */
    boolean updateNowMoney(User user, BigDecimal price, String type);
}
